home *** CD-ROM | disk | FTP | other *** search
/ TeX 1995 July / TeX CD-ROM July 1995 (Disc 1)(Walnut Creek)(1995).ISO / macros / musictex / older-versions / musictex.507 / MUSIKGEN.MF < prev    next >
Text File  |  1994-04-01  |  36KB  |  1,253 lines

  1. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  2. %  this is musikgen.mf
  3. %
  4. %  Version 5.02 [March 94] Daniel Taupin changed '047 to a + for percussion
  5. %
  6. %  Version 5.01 [January 94] Daniel Taupin
  7. %
  8. %  Version 4.89 [September 93] Andreas Egler
  9. %               - blacker influence now
  10. %               - redesigned chars 71, 72, 53, 123
  11. %
  12. %  Version 4.88 [January 93] Ross Mitchell
  13. %               - redesigned chars 63, 64, 65, 66
  14. %
  15. %  Version 4.87 [] Daniel Taupin
  16. %
  17. %  Version 2.00 [] Daniel Taupin
  18. %
  19. %  Version 1.00 [August 86] Angelika Schofer/Andrea Steinbach
  20. %
  21. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  22.  
  23. %"At most 15 different nonzero heights, 15 different nonzero depths, ...
  24. % may appear in a single fonts. If these limits are exceeded, METAFONT will
  25. % change one or more values, ..., until the restriction hold. A warning
  26. % message is issued ..; for example 'some charht values had to be adjusted
  27. % by as much as 0.12pt' means that you had too many different nonzero
  28. % heights, ..."                                        METAFONT-Book App. F
  29.  
  30. %<<<>>> This indicates the heights I've changed
  31.  
  32. %{{{ This always indicates a lowres fix to avoid seperated points
  33. %}}} and/or 'invisible' lines. It doesn't affect higher resolutions !!
  34.  
  35. pair pone, ptwo;
  36. transform t;
  37. path p;
  38. picture save_pic;
  39.  
  40. pen thin_pen, med_pen;
  41. thin_pen:= pencircle scaled thin;
  42. med_pen:= pencircle scaled med;
  43.  
  44. apog_fact=0.75;
  45. apog_nhh=apog_fact*nhh;
  46. apog_nhh#=apog_fact*nhh#;
  47. apog_nhw#=apog_fact*nhw#;
  48.  
  49. %%%AE it's somewhat faster to use already computed pictures
  50. def mirror (expr pone, ptwo) =
  51.     currentpicture:=currentpicture reflectedabout(round(pone),round(ptwo))
  52. enddef;
  53. def add_mirror (expr pone, ptwo) =
  54.     addto currentpicture also currentpicture 
  55.           reflectedabout (round(pone), round(ptwo))
  56. enddef;
  57.  
  58. def savepic = save_pic:= currentpicture enddef;
  59. def callpic = currentpicture:= save_pic enddef;
  60. def clearpic = save_pic:= nullpicture enddef;
  61.  
  62. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  63. % basic macros for noteheads and flags %
  64. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  65. % noteheads %
  66. %%%%%%%%%%%%%
  67. def drawnoteb(expr noteheadwidth, noteheadheight, theta_a,
  68.               theta_b, theta_c, width_a, width_b)  =
  69.     penpos1(width_a, theta_a);       %         .l
  70.     penpos3(width_a, 180+theta_a);   %         .2
  71.     penpos2(width_b, 180+theta_b);   %         .r
  72.     penpos4(width_b, theta_b);       %.l.1.r         .r.3.l
  73.     x1l =  y1 = y3 = 0;              %         .r
  74.     x3l = 2x2 = 2x4 = noteheadwidth; %         .4
  75.     y2l =-y4l = noteheadheight;      %         .l
  76.     t:= identity rotatedaround ((x2,0),theta_c);
  77.     penstroke (z1e{up}..z2e{right}..z3e{down}..z4e{left}..cycle)
  78.                transformed t;
  79. %{{{
  80.     currentpen:= pencircle;
  81.     draw (z1{up}..z2{right}..z3{down}..z4{left}..cycle) transformed t
  82. %}}}
  83. enddef;
  84.  
  85. def drawnotew(expr noteheadwidth, noteheadheight, theta_a,
  86.               theta_b, width_a, width_b)  =
  87.     penpos1(width_a, theta_a);       %         .l
  88.     penpos3(width_a, 180+theta_a);   %         .2
  89.     penpos2(width_b, 180+theta_b);   %         .r
  90.     penpos4(width_b, theta_b);       %.l.1.r        .r.3.l
  91.     x1l= y1l  = y3l  = 0;            %         .r
  92.     x3l= 2x2l = 2x4l = noteheadwidth;%         .4
  93.     y2l=-y4l  = noteheadheight;      %         .l
  94.     fill z1l{up}..z2l{right}..z3l{down}..z4l{left}..cycle;
  95.     erase fill z1r{up}..z2r{right}..z3r{down}..z4r{left}..cycle;
  96. %{{{
  97.     currentpen:= pencircle;
  98.     draw z1{up}..z2{right}..z3{down}..z4{left}..cycle;
  99. %}}}
  100.     penlabels(1,2,3,4)
  101. enddef;
  102.  
  103. %%%AE I found in a notebook a whole note which looks slight different
  104. def drawnote_w(expr noteheadwidth, noteheadheight, theta, width_a, width_b)=
  105.     x1= y1 = y3 = y5 = y7 = 0;
  106.     x3= 2x2 = 2x4 = 2x6 = 2x8 = noteheadwidth;
  107.     y2=-y4 = noteheadheight;
  108.     x5= x3-x7 = x1+width_a;
  109.     y6=-y8 = y2-width_b;
  110.     fill z1{curl3}..z2..{curl3}z3{curl3}..z4..{curl3}cycle;
  111.     unfill (z5..z6..z7..z8..cycle) rotatedaround ((x2,0),theta);
  112.     labels(range 1 thru 8);
  113. enddef;
  114. %%%AE if you have GFtoDVI and want to see the character,
  115. %     uncomment the next four lines
  116. %beginchar(0,1.5nhh#, .5nhh#, .5nhh#);
  117. %    drawnote_w(w, h, 45, 1.6thick, .5thin);
  118. %endchar;
  119. %end
  120.  
  121. %%%%%%%%%
  122. % flags %
  123. %%%%%%%%%
  124. %%%AE the penstrike macro is a copy of plain's penstroke
  125. %     macro, 'fill' is replaced by 'filldraw', this is
  126. %     responsible for 'strange path' when sharp turns ahead (intersectionp)
  127. %     the second macro does the same with a little more 'tolerance'
  128. %
  129. %     I don't like it at all, because the flags are thicker
  130. %     on lowres than (or as?) on highres devices
  131. %     {Sorry, my english is very bad, nevertheless I hope you
  132. %      understand my words}
  133. %
  134. %%%def penstrike text t =
  135. %%% forsuffixes e = l,r: path_.e:=t; endfor
  136. %%% if cycle path_.l: cyclestroke_
  137. %%% else: filldraw path_.l -- reverse path_.r -- cycle fi enddef;
  138. %
  139. %def penstrike text t =
  140. % forsuffixes e = l,r: path_.e:=t; endfor
  141. % if cycle path_.l: cyclestroke_
  142. % else: fill path_.l -- reverse path_.r -- cycle;
  143. %       draw path_.l -- reverse path_.r -- cycle fi enddef;
  144.  
  145. def flagshape(suffix i) (expr width, height, thick,
  146.                          thin, shiftx, shifty, flagsense) =
  147.     pair intersectionp;               %  .1
  148.     penpos[i](thick+blacker, 90);     %
  149.     penpos[i+1](3.25thin+blacker, 70);%       .2
  150.     penpos[i+3](thin, -45);           %
  151.     x[i]   = rt shiftx;               %           .3
  152.     y[i]   = height+shifty-thick/2;   %
  153.     x[i+1] = shiftx+3/8width;         %        .4
  154.     y[i+1] = height+shifty-.95thick;  %
  155.     x[i+2] = shiftx+width-thin/2;
  156.     y[i+2] = height+shifty-2thick;
  157.     x[i+3] = shiftx-thin/2+0.6width;
  158.     y[i+3] = shifty;
  159.     if i>1: intersectionp = z[i-2]; else: intersectionp = z[i+3]; fi;
  160.     if flagsense>0:
  161.        penpos[i+2](1.25thin+blacker, 35);
  162.     else:
  163.        penpos[i+2](1.05thin+blacker, 0);
  164.     fi;
  165.     penstroke z[i]e..z[i+1]e..z[i+2]e{down}..intersectionp;
  166. %{{{
  167.     currentpen:= pencircle;
  168.     draw lft z[i]..z[i+1]..z[i+2]{down}..intersectionp;
  169. %}}}
  170.     penlabels (range i thru i+3)
  171. enddef;
  172.  
  173. % Added by D. Taupin Jan 1993
  174. beginchar(14,0.5nhw#,0,0); "Song system limit up";
  175. %%%AE clearxy is already done by 'beginchar();'
  176. %   clear;
  177.     x1=y1=y2=0; 3x2=x3=3w; y3=nhh;
  178.     p:= z1---z2..z3;
  179.     pickup penrazor scaled med rotated 90;
  180.     draw p;
  181. %{{{
  182.     currentpen:= pencircle;
  183.     draw p;
  184. %}}}
  185.     savepic;
  186. endchar;
  187.  
  188. beginchar(15,0.5nhw#,0,0); "Song system limit down";
  189.     callpic;
  190.     mirror (origin, right);
  191. endchar;
  192.  
  193. for n:=1 upto 4:
  194. %<<<>>>(0.5+0.1*n)*nhh#
  195.     beginchar(15+n, 4n*nhw#, 0, (0.5+0.1n)*nhh#); "Crescendo";
  196.         pickup med_pen;
  197.         draw (0,(0.5+0.1n)*nhh)--(w,0)--(0,-d);
  198.     endchar;
  199. endfor;
  200.  
  201. for n:=1 upto 4:
  202. %<<<>>>(0.5+0.1*n)*nhh#
  203.     beginchar(19+n, 4n*nhw#, 0, (0.5+0.1n)*nhh#); "Decrescendo";
  204.         pickup med_pen;
  205.         draw (w,(0.5+0.1n)*nhh)--(0,0)--(w,-d);
  206.     endchar;
  207. endfor;
  208.  
  209. %%%%%%%%%%%
  210. % accents %
  211. %%%%%%%%%%%
  212. dely:=1.15nhh+.2pt;
  213.  
  214. %%%AE 'fill fullcircle' is faster and produce 'nicer' circles
  215. beginchar(24, nhw#, nhh#, 0); "Point au-dessus de la note";
  216.     fill fullcircle scaled thick shifted (.5w, dely);
  217.     savepic;
  218. endchar;
  219.  
  220. beginchar(25, nhw#, 0, nhh#); "Point au-dessous de la note";
  221.     callpic;
  222.     mirror (origin, right);
  223. endchar;
  224.  
  225. beginchar(26, nhw#, nhh#, 0); "Barre au-dessus de la note";
  226. %%%AE faster
  227.     fill unitsquare xscaled w yscaled 1.25med shifted (0,dely-.625med);
  228.     savepic;
  229. endchar;
  230.  
  231. beginchar(27, nhw#, 0, nhh#); "Trait au-dessous de la note";
  232.     callpic;
  233.     mirror (origin, right);
  234. endchar;
  235.  
  236. beginchar(28, nhw#, nhh#, 0); "Accent (pizz.) au-dessus de la note";
  237.     rayon:= thin+.1nhh;
  238.     z1=(0.5w,w+rayon);
  239.     z2=(0.5w-rayon,w);
  240.     z3=(0.5w,w-0.45nhh);
  241.     z4=(0.5w+rayon,w);
  242.     fill z3--z4{up}..z1..{down}z2--cycle;
  243.     savepic;
  244. endchar;
  245.  
  246. beginchar(29, nhw#, 0, nhh#); "Accent (pizz.) au-dessous de la note";
  247.     callpic;
  248.     mirror (origin, right);
  249. endchar;
  250.  
  251. %%%AE why 1.5nhh ???
  252. beginchar(30, nhw#, 1.5nhh#, 0); "Accent (sforz.) au-dessus de la note";
  253.     pickup med_pen;
  254.     draw (-.2w, 1.6nhh)--(1.2w, 1.3nhh)--(-.2w, nhh);
  255.     savepic;
  256. endchar;
  257.  
  258. beginchar(31, nhw#, 0, nhh#); "Accent (sforz.) au-dessous de la note";
  259.     callpic;
  260.     mirror (origin, right);
  261. endchar;
  262.  
  263. %%%%%%%%%
  264. % breve %
  265. %%%%%%%%%
  266. def breve =
  267.     fill unitsquare xscaled w yscaled .5h shifted (0,.25h);
  268.     add_mirror (origin, right);
  269.     nh:= .7nhh;
  270.     pickup thin_pen;
  271.     draw (0,nh)--(0,-nh); draw (w,nh)--(w,-nh);
  272. enddef;
  273.  
  274. %<<<>>>.7nhh#
  275. beginchar(32, nhw#, 0.5nhh#, 0.5nhh#); "Breve";
  276.     breve;
  277. endchar;
  278.  
  279. beginchar(33, nhw#, .5nhh#, .5nhh#); "Quarter note";
  280.     w:=w+2thinwidth;
  281. %%%AE a little bit smaller, because a quarter note
  282. %     seems to be thicker as an half note
  283.     drawnoteb(w, .99h, 0, 90, 20, w/2, h);
  284. endchar;
  285.  
  286. beginchar(34, nhw#, .5nhh#, .5nhh#); "Half note";
  287.     w:=w+2thinwidth;
  288.     drawnoteb(w, h, 0, 90, 20, thin, thick);
  289. endchar;
  290.  
  291. beginchar(35,1.5nhh#, .5nhh#, .5nhh#); "Whole note";
  292.     drawnotew(w, h, 0, 30, 1.3thick, 1.75thin);
  293. endchar;
  294.  
  295. %<<<>>>.7nhh#
  296. beginchar(36, 2nhw#, 0.5nhh#, 0.5nhh#); "Semi-breve";
  297.     breve;
  298. endchar;
  299.  
  300. beginchar(37, apog_nhw#, .5apog_nhh#, .5apog_nhh#); "Small quarter note";
  301.     w:=w+2thinwidth;
  302.     drawnoteb(w, .99h, 0, 90, 20, w/2, h);
  303. endchar;
  304.  
  305. %beginchar(38, apog_nhw#, .5apog_nhh#, .5apog_nhh#); "Small half note";
  306. %    w:=w+2thinwidth;
  307. %    drawnoteb(w, h, 0, 90, 20, thin, apog_fact*thick);
  308. %endchar;
  309.  
  310. def doublesharp (expr high)=
  311.     clear;
  312.     x4= .5w; y4=high;
  313.     x1=w-x7=.5w+1/25nhh; y1=y7=0;
  314.     x2=w-x6=.51w+thin; y2=y6=.3y4;
  315.     x3=w-x5=.58w+thin; y3=y5=.6y4;
  316.     t:= identity rotatedaround ((.5w, 0), 90);
  317.     fill (z1{up}..z2..z3..{nw}z4 & z4{sw}..z5..z6..{down}z7--z1--cycle)
  318.           rotatedaround ((.5w, 0), 45);
  319.     addto currentpicture also currentpicture transformed t;
  320.     addto currentpicture also currentpicture transformed (t transformed t);
  321.     labels (1,2,3,4,5,6,7)
  322. enddef;
  323.  
  324.  
  325. beginchar(38, nhw#, nhh#, nhh#); "Circled doublesharp";
  326.     doublesharp (.62w);
  327.     pickup thin_pen;
  328.     draw (0,0){up}..{right}(0.5nhw,0.5nhw)..
  329.       {down}(nhw,0)..{left}(0.5nhw,-0.5nhw)..cycle;
  330. endchar;
  331.  
  332.  
  333.  
  334. % beginchar(39, 1.5apog_nhh#, .5apog_nhh#, .5apog_nhh#); "Small full note";
  335. %    drawnotew(w, h, 0, 30, apog_fact*1.3thick, 1.5thin);
  336. % endchar;
  337.  
  338. %
  339. beginchar(39, nhw#, nhh#, nhh#); "Bongo cross";
  340.     pickup pencircle scaled med;
  341.     draw (0,0)--(nhw,0);
  342.     draw (0.5nhw,-0.5nhw) -- (0.5nhw,0.5nhw)
  343. endchar;
  344.  
  345. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  346. % general parameters for flags %
  347. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  348. flagw:=0.8nhw;
  349. flagthick:=nhh;
  350. flagthin:=5thinwidth;
  351.  
  352. def cflag (expr sense) =
  353.     flagshape(1, flagw, h, flagthick, flagthin, 0, 0, sense);
  354.     if sense<0 : mirror ((0,h/2), (1,h/2)); fi
  355. enddef;
  356.  
  357. def flagloop (expr sense, doitagain) =
  358.     flagshape(1, flagw, 2.50flagthick, 2/3flagthick,
  359.               flagthin, 0, 0, sense);
  360.     for xyz:=1 upto doitagain:
  361.         flagshape([4xyz+1], flagw, 2.25flagthick, 2/3flagthick,
  362.                   flagthin, 0, (.75xyz+.25)*flagthick, sense);
  363.     endfor;
  364.     if sense<0 : mirror ((0,h/2), (1,h/2)); fi
  365. enddef;
  366.  
  367. def ccflag (expr sense) = flagloop(sense, 1) enddef;
  368. def cccflag (expr sense) = flagloop(sense, 2) enddef;
  369. def ccccflag (expr sense) = flagloop(sense, 3) enddef;
  370. def cccccflag (expr sense) = flagloop(sense, 4) enddef;
  371.  
  372. beginchar(40, 0, 3nhh#, 0); "1/8flag down";
  373.     cflag(1);
  374.     savepic;
  375. endchar;
  376.  
  377. % Acciacaturra, added by D.Taupin Jan 93.
  378. % idem mais avec barre (appogiature)
  379. beginchar(12, 0, 3nhh#, 0); "Acciacaturra stem up";
  380.     callpic;
  381.     pickup med_pen;
  382.     x1=-0.25nhw; y1=0.2h; x2=1.1nhw; y2=y1+0.6(x2-x1);
  383.     draw z1--z2;
  384. endchar;
  385.  
  386. beginchar(41, 0, 3.25nhh#, 0); "1/16flag down";
  387.     ccflag(1);
  388. endchar;
  389.  
  390. beginchar(42, 0, 4.00nhh#, 0); "1/32flag down";
  391.     cccflag(1);
  392. endchar;
  393.  
  394. beginchar(43, 0, 4.75nhh#, 0); "1/64flag down";
  395.     ccccflag(1);
  396. endchar;
  397.  
  398. beginchar(44, 0, 5.50nhh#, 0); "1/128flag down";
  399.     cccccflag(1);
  400. endchar;
  401.  
  402. %%%
  403. % flags up should be wider
  404. %%%
  405. flagw:=nhw;
  406.  
  407. beginchar(45, 0, 3nhh#, 0); "1/8flag up";
  408.     cflag(-1);
  409.     savepic;
  410. endchar;
  411.  
  412. % added by D.Taupin Jan 93.
  413. % idem mais avec barre (appogiature)
  414. beginchar(13, 0, 3nhh#, 0); "Acciacaturra stem down";
  415.     callpic;
  416.     pickup med_pen;
  417.     x1=-0.25nhw; y1=1.6nhh; x2=1.2nhw; y2=y1+0.6(x2-x1);
  418.     draw z1--z2;
  419. endchar;
  420.  
  421. beginchar(46, 0, 3.25nhh#, 0); "1/16flag up";
  422.     ccflag(-1);
  423. endchar;
  424.  
  425. beginchar(47, 0, 4.00nhh#, 0); "1/32flag up";
  426.     cccflag(-1);
  427. endchar;
  428.  
  429. beginchar(48, 0, 4.75nhh#, 0); "1/64flag up";
  430.     ccccflag(-1);
  431. endchar;
  432.  
  433. beginchar(49, 0, 5.50nhh#, 0); "1/128flag up";
  434.     cccccflag(-1);
  435. endchar;
  436.  
  437. %%%%%%%%%%%%%%%
  438. % accidentals %
  439. %%%%%%%%%%%%%%%
  440. def flat (expr reduction, shiftx, flatsense) =
  441.     clear;
  442.     fthick:= reduction*s;
  443.     penpos4(4/3fthick+blacker,0);  % 1
  444.     penpos3(1/2fthick+blacker,-90);%
  445.     penpos6(4/7fthick+blacker,90); %   6
  446.     penpos2(.1thinwidth, 180);     %  / \
  447.     x1 = x2 = x3 = x5 = fthick;    % 2   4
  448.     y1 = 6fthick; y2l= 0.5y4;      %    /
  449.     y3l=-2fthick; y5= y3r;         % 3,5
  450.     x4 = 3.6fthick; y4 = 0.1fthick;
  451.     y6r= 2fthick; x6= 0.5(x2+x4);
  452.     t:=identity shifted (shiftx,0);
  453.     p:= (z1--z5) transformed t;
  454.     pickup penrazor scaled (2sind40*thin) rotated 40;
  455.     draw p;
  456. %{{{
  457.     currentpen:= pencircle;
  458.     draw p;
  459. %}}}
  460.     penstroke (z2e..{right}z6e..z4e{sw+down}..{sw}z3e) transformed t;
  461.     if flatsense<0: mirror (z5 transformed t, z1 transformed t); fi;
  462.     penlabels (1,2,3,4,5,6)
  463. enddef;
  464.  
  465. %<<<>>> 2nhh#
  466. beginchar(50, nhw#, 1.5nhh#, 1.5nhh#); "Flat";
  467.     flat (1, 0, 1);
  468.     savepic;
  469. endchar;
  470.  
  471. %<<<>>> 2nhh#
  472. beginchar(51,1.7nhw#, 1.5nhh#, 1.5nhh#); "Doubleflat";
  473.     callpic;
  474.     addto currentpicture also currentpicture shifted (.7nhw, 0);
  475. endchar;
  476.  
  477. def sharp =
  478.     clear;
  479.     reduction:=w/0.8nhw;
  480.     sthick:= .5reduction*thick;
  481.     y1 =-y7= h-1.5sthick; y2 =-y8 = .5sthick-h;
  482.     x1 = x2 = y3 = -y6 = w-x7 = w-x8 = 2sthick;
  483.     y4 =-y5 = y3 + 3sthick;
  484.     x3 = x5 = 0; x4 = x6 = w;
  485.     pickup penrazor scaled thin rotated angle(z4-z3);
  486.     draw z1--z2; draw z8--z7;
  487. %{{{
  488.     currentpen:= pencircle;
  489.     draw z1--z2; draw z8--z7;
  490. %}}}
  491.     pickup penrazor scaled 3sthick rotated 90;
  492.     draw z3--z4; draw z5--z6;
  493.     labels (range 1 thru 8)
  494. enddef;
  495.  
  496. beginchar(52, 0.8nhw#, 1.5nhh#, 1.5nhh#); "Sharp";
  497.     sharp;
  498. endchar;
  499.  
  500. %<<<>>>.5nhw#
  501. beginchar(53, nhw#, nhh#, nhh#); "Doublesharp";
  502.     doublesharp (.65w);
  503. endchar;
  504.  
  505. def natural =
  506.     clear;
  507.     reduction:=w/0.8nhw;
  508.     nthick:= 3/4reduction*thick;
  509.     x1 = x2 = x3 = nthick;
  510.     x5 = x6 = x4 = w-x1;
  511.     y1 = -y6 = h;
  512.     y2 = -y5 = 1.6nthick;
  513.     y4 = -y3 = y2+4/3nthick;
  514.     pickup penrazor scaled thin rotated angle(z4-z2);
  515.     draw lft z1--bot lft(x3,y3-nthick);
  516.     draw top rt(x4,y4+nthick)--rt z6;
  517. %{{{
  518.     pickup pencircle;
  519.     draw lft z1--lft(x3,y3-nthick);
  520.     draw rt(x4,y4+nthick)--rt z6;
  521. %}}}
  522.     pickup penrazor scaled 2nthick rotated 90;
  523.     draw z2--z4; draw z3--z5;
  524.     labels(1,2,3,4,5,6)
  525. enddef;
  526.  
  527. beginchar(54, 0.8nhw#, 1.5nhh#, 1.5nhh#); "Natural";
  528.     natural;
  529. endchar;
  530.  
  531. %<<<>>> 2nhh#
  532. beginchar(55, nhw#, 1.5nhh#, 1.5nhh#); "1/4 flat";
  533.     flat (1, 0.65nhw, -1);
  534. endchar;
  535.  
  536. %<<<>>> 2nhh#
  537. beginchar(56, 1.7nhw#, 1.5nhh#, 1.5nhh#); "3/4 flat";
  538.     flat (1, 0.65nhw, -1); flat (1, 0.65nhw, 1);
  539. endchar;
  540.  
  541. beginchar(57, nhw#, .5nhh#, .5nhh#); "Gregorian notes";
  542.     fill (0.5w-0.8h,0)--(0.5w,h)--(0.5w+0.8h,0)--(0.5w,-h)--cycle;
  543. endchar;
  544.  
  545. beginchar(0, nhw#, .5nhh#, .5nhh#); "Gregorian diamond";
  546.     fill (0,0)--(0.5w,0.5nhw)--(w,0)--(0.5w,-0.5nhw)--cycle;
  547. endchar;
  548.  
  549. beginchar(1, 0.71*nhw#, .5nhh#, .5nhh#); "Gregorian square";
  550.     fill (0,0.355nhw)--(w,0.355nhw)--(w,-0.355nhw)--(0,-0.355nhw)--cycle;
  551. endchar;
  552.  
  553. beginchar(2, 0.71*nhw#, .5nhh#, .5*nhh#); "Gregorian square left";
  554.     fill (0,0.355nhw)--(w,0.355nhw)--(w,-0.355nhw)--(0,-0.355nhw)--cycle;
  555.     pickup thin_pen;
  556.     draw (0.5thin,0.355nhw-thin)--(0.5thin,-1.5nhh+0.5thin);
  557. endchar;
  558.  
  559. beginchar(3, 0.71*nhw#, .5nhh#, .5nhh#); "Gregorian square right";
  560.     fill (0,0.355nhw)--(w,0.355nhw)--(w,-0.355nhw)--(0,-0.355nhw)--cycle;
  561.     pickup thin_pen;
  562.     draw (w-0.5thin,0.355nhw-thin)--(w-0.5thin,-1.5nhh+0.5thin);
  563. endchar;
  564.  
  565. beginchar(4, nhw#, 3nhh#, 0); "Gregorian C clef";
  566.     fill (0,2nhh+0.8nhh)..{right}(0.5w,2nhh+nhh)--(w,2nhh+nhh)--
  567.       (w,2nhh+0.3nhh)--(0.5w,2nhh+0.3nhh){left}..(0,2nhh+0.1nhh)--cycle;
  568.     fill (0,2nhh-0.8nhh)..{right}(0.5w,2nhh-nhh)--(w,2nhh-nhh)--
  569.       (w,2nhh-0.3nhh)--(0.5w,2nhh-0.3nhh){left}..(0,2nhh-0.1nhh)--cycle;
  570.     pickup thin_pen;
  571.     draw (0.5thin,2.5nhh)--(0.5thin,1.5nhh);
  572. endchar;
  573.  
  574. %%%%%%%%%
  575. % rests %
  576. %%%%%%%%%
  577. beginchar(58,1/2nhw#, 3nhh#, 0); "Dp";
  578.     fill unitsquare xscaled w yscaled 1/3h shifted (0, 2/3h);
  579. endchar;
  580.  
  581. beginchar(59,1/2nhw#, 3nhh#, 0); "Ddp";
  582.     fill unitsquare xscaled w yscaled 2/3h shifted (0, 1/3h);
  583. endchar;
  584.  
  585. beginchar(60, nhw#, 3nhh#, 0); "Full rest";
  586.     fill unitsquare xscaled w yscaled .5nhh shifted (0,h-.5nhh);
  587. endchar;
  588.  
  589. %<<<>>> 2.5nhh#
  590. beginchar(61, nhw#, 3nhh#, 0); "Half rest";
  591.     fill unitsquare xscaled w yscaled .5nhh shifted (0,h-nhh);
  592. endchar;
  593.  
  594. beginchar(62, nhw#, 4nhh#, 0); "Quarter rest";
  595.     rthin:= 1/8 nhh;           % .1
  596.     rthick:= 2 thick+rthin;    %       .2
  597.     alpha:= -50;               %    .3
  598.     penpos1 (rthin, 90+alpha); % .4
  599.     penpos5 (rthin, alpha);    %       .5,10
  600.     penpos2 (rthick, alpha);   %   .6
  601.     penpos4 (rthick, alpha);   %
  602.     penpos3 (3/4rthick, alpha);%       .7
  603.     penpos6 (4/3thick, alpha);
  604.     penpos7 (rthin, 45);
  605.     y1l = h - 2s;
  606.     x1l = 2s;
  607.     z2r = z1 +(nhh* right) rotated alpha;
  608.     z3  = 1/2[z2,z4];
  609.     z4  = (w,h) scaled .55;
  610.     z5  = z4l+(nhh* right) rotated alpha;
  611.     x6l = x4l; y6r = 1.45nhh;
  612.     x7  = 0.9w; y7= nhh-.5s;
  613.     z10 = z5r shifted (sqrt(2)*rthin/4,sqrt(2)*rthin/4);
  614.  
  615.     pickup penrazor scaled rthin rotated 45;
  616.     draw z1--z2r; draw z4l--z10;
  617.     penstroke z2e..z3e..z4e;
  618.     penstroke z5e..z6e..z7e;
  619.     penlabels(1,2,3,4,5,6,7,10);
  620. endchar;
  621.  
  622. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  623. % Quaver rest and submultiples. %
  624. % Ross Mitchell,  January 1993  %
  625. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  626. %%%
  627. %   Draw the crook needed for quaver rests and shorter.
  628. %   The crook extends left from the point z.i on the stem.
  629. %%%
  630. def crook(suffix i)=
  631.     x3:=x.i-6.5fact; y3:=top y.i-3.0fact;
  632.     x4:=x.i-6.0fact; y4:=    y.i+0.5fact;
  633.     draw z.i{dir 240}..{dir 160}z3;
  634.     filldraw z3{dir 160}..z4{dir-20}..{dir 160}z3..cycle
  635. enddef;
  636.  
  637. beginchar(63, 2nhh#, 3nhh#, 0); "Quaver rest";
  638.     z1=(nhh,nhh);
  639.     z2-z1=whatever*dir 70;    %  Angle the stem at 70 degrees.
  640. %%%
  641. %   Define the scaling factor `fact' implicitly.
  642. %   This value will be used for the shorter rests as well.
  643. %%%
  644.     z2-z1=(5fact,1.7nhh);
  645.     pickup med_pen;
  646.     draw z1..z2;
  647.     crook(2);
  648.     penlabels (1,2,3,4);
  649. endchar;
  650.  
  651. beginchar(64,2nhh#, 3nhh#, 0); "Semiquaver rest";
  652.     z1=(nhh,0);
  653.     z2-z1=whatever*dir 75;    %  Angle the stem at 75 degrees.
  654.     y2-y1=2.7nhh;
  655.     z5-z2=whatever*(z1-z2); y5=y2-nhh;
  656.     pickup med_pen;
  657.     draw z1..z2;
  658.     crook(2); crook(5);
  659.     penlabels (1,2,3,4,5);
  660. endchar;
  661.  
  662. beginchar(65,2nhh#, 4nhh#, 0); "Demisemiquaver rest";
  663.     z1=(nhh,0);
  664.     z2-z1=whatever*dir 80;    %  Angle the stem at 80 degrees.
  665.     y2-y1=3.7nhh;
  666.     z5-z2=whatever*(z1-z2); y5=y2-nhh;
  667.     z6-z2=whatever*(z1-z2); y6=y5-nhh;
  668.     pickup med_pen;
  669.     draw z1..z2;
  670.     crook(2); crook(5); crook(6);
  671.     penlabels (1,2,3,4,5,6);
  672. endchar;
  673.  
  674. %<<<>>> 5nhh#
  675. beginchar(66,2nhh#, 4.75nhh#, 0); "Hemidemisemiquaver rest";
  676.     z1=(nhh,0);
  677.     z2-z1=whatever*dir 82;    %  Angle the stem at 82 degrees.
  678.     y2-y1=4.7nhh;
  679.     z5-z2=whatever*(z1-z2); y5=y2-nhh;
  680.     z6-z2=whatever*(z1-z2); y6=y5-nhh;
  681.     z7-z2=whatever*(z1-z2); y7=y6-nhh;
  682.     pickup med_pen;
  683.     draw z1..z2;
  684.     crook(2); crook(5); crook(6); crook(7);
  685.     penlabels (1,2,3,4,5,6,7);
  686. endchar;
  687.  
  688. %%%%%%%%%%%%%
  689. % ornaments %
  690. %%%%%%%%%%%%%
  691. beginchar (67, 2nhw#, nhh#, 0); "Ornament";
  692.     x1=w-x6=0.2w; y1r=h; y6=h-y1;
  693.     x2r=0; y2=0.5h; x5=w-x2; y5=h-y2;
  694.     x3=0.22w; y3r=0; x4=w-x3; y4=h-y3;
  695.     penpos1 (med, 90);
  696.     penpos2 (med, 180);
  697.     penpos3 (thick,-40);
  698.     penpos4 (thick,-40);
  699.     penpos5 (med, 180);
  700.     penpos6 (med, 90);
  701.     penstroke z1e..{down}z2e{down}..{right}z3e{right}
  702.               ..{right}z4e{right}..{down}z5e{down}..z6e;
  703.     fill fullcircle scaled (s+thick) shifted (x1,y1r-thick);
  704.     fill fullcircle scaled (s+thick) shifted (x6,y6l+thick);
  705.     penlabels(1,2,3,4,5,6);
  706.     savepic;
  707. endchar;
  708.  
  709. beginchar (68, 2nhw#, nhh#, 0); "Ornament";
  710.     callpic;
  711.     mirror ((.5w,0), (.5w,1));
  712. endchar;
  713.  
  714. %<<<>>>3.5apog_nhh#
  715. beginchar(69, apog_nhw#, 3.25apog_nhh#, .5apog_nhh#); "Appogiature stem up";
  716.     flagshape(1,0.8w, 3apog_nhh, apog_nhh, 4thinwidth, w, 0.5apog_nhh, 1);
  717.     clear;
  718.     drawnoteb(w, 0.5apog_nhh, 0, 90, 20, w/2, apog_nhh/2);
  719.     clear;
  720.     pickup pencircle scaled .8med;
  721.     draw (w-2thinwidth,0)--(w-2thinwidth,3.5apog_nhh);
  722.     x1=-0.1w; y1=0.6apog_nhh; x2=2w; y2=y1+0.6(x2-x1);
  723.     draw z1--z2;
  724. endchar;
  725.  
  726. beginchar(70, apog_nhw#, 0.5apog_nhh#, 3.5apog_nhh#); "Appogiature stem down";
  727.     flagshape(1,w, 3apog_nhh, apog_nhh, 4thinwidth, 0.2pt, apog_nhh, -1);
  728.     mirror ((0,h/2), (1,h/2));
  729.     clear;
  730.     drawnoteb(w, 0.5apog_nhh, 0, 90, 20, w/2, apog_nhh/2);
  731.     pickup pencircle scaled .8med;
  732.     draw (2thinwidth,0)--(2thinwidth,-d);
  733.     clear;
  734.     x1=-0.3w; y1=-1.6apog_nhh; x2=1.3w; y2=y1+0.6(x2-x1);
  735.     draw z1--z2;
  736. endchar;
  737.  
  738. %%%%%%%%%
  739. % clefs %
  740. %%%%%%%%%
  741. def violin(expr reduction) =
  742.     clear;
  743.     gx:=reduction*-nhw;
  744.     gy:=reduction*nhh;
  745.     gthick:=1.6reduction*thick;
  746.     gthin:=.95reduction*med;
  747.  
  748.     x1=x4=23/24gx+w;  x2=x10=3/4gx+w;  x3r=w; x8l=7/8gx+w;
  749.     x5=x11r=2gx+w;  x6=gx+w;  x7=1/2gx+w;  x9=5/4gx+w;
  750.     y1=3/8gy;  y2=y5=2gy;  y3=gy;  y4r=0;  y6=27/8gy;
  751.     y7l=21/4gy;  y8l=23/4gy;  y9=17/4gy;  y10=y11=-7/8gy;
  752.     penpos1(gthin,180);
  753.     penpos2(gthick,90);
  754.     penpos3(gthick,0);
  755.     penpos4(5/4gthin,-90);
  756.     penpos5(11/8gthick,110);
  757.     penpos6(5/4gthick,120);
  758.     penpos7(4/5gthin,-140);
  759.     penpos8(5/4gthick,-80);
  760.     penpos9(3/8gthick,0);
  761.     penpos10(gthin,0);
  762.     penpos11(1/2gthick,180);
  763.     penstroke z1e{left}..z2e..z3e..z4e..z5e{up+ne}..z6e..{up+nw}z7e
  764.               ..z8e{sw}..{down}z9e{down}..{down}z10e..z11e;
  765. %{{{
  766.     currentpen:= pencircle;
  767.     draw z3..z4..z5{up+ne}..z6..{up+nw}z7
  768.          ..z8{sw}..{down}z9{down}..{down}z10..z11;
  769. %}}}
  770.     fill fullcircle scaled (3(x2-x1)) shifted (x11+11/40gy, y11);
  771.     penlabels(range 1 thru 11)
  772. enddef;
  773.  
  774. %<<<>>> 6nhh#
  775. beginchar(71,3.25nhw#, 5.50nhh#, 2nhh#); "G-clef";
  776.     violin(1);
  777. endchar;
  778.  
  779. %<<<>>> 6nhh#
  780. beginchar(72,2.60nhw#, 5.50nhh#, 2nhh#); "small G-clef";
  781.     violin(0.8);
  782. endchar;
  783.  
  784. % clef de fa par D. Taupin
  785. def bass (expr reduction) =
  786.     clear;
  787.     x2=0.80reduction*nhw; y2=3nhh;
  788.     x1=x2r+1.25reduction*s; y1=y2;
  789.     x3=x2+0.71reduction*nhw; y3=y2+reduction*nhh;
  790.     x4=x3+0.71reduction*nhw; y4=y2-0.2reduction*nhh;
  791.     x6=x2-6reduction*thinwidth; y6=y2-2.2reduction*nhh;
  792.     x7=x4+0.50reduction*nhw; x8=x7;
  793.     y7=y2+0.38reduction*nhh; y8=y2-0.38reduction*nhh;
  794.  
  795.     penpos2(.6thick*reduction,180);
  796.     penpos3(.6thick*reduction, 90);
  797.     penpos4(2thick*reduction,0);
  798.     penpos6(.4thick*reduction,-10);
  799.  
  800.     penstroke(z2e{up}..{right}z3e{right}..{down}z4e{down}
  801.               ..{left+0.1down}z6e);
  802. %{{{
  803.     currentpen:= pencircle;
  804.     draw (z2{up}..{right}z3{right}..{down}z4{down}..{left+0.1down}z6);
  805. %}}}
  806.     fill fullcircle scaled (2(x2r-x1)) shifted z1;
  807.     fill fullcircle scaled 1.7s shifted z7;
  808.     fill fullcircle scaled 1.7s shifted z8;
  809.     penlabels(1,2,3,4,6)
  810. enddef;
  811.  
  812. beginchar(73, 3nhw#, 4nhh#, 0); "F-clef";
  813.     bass(1.0);
  814. endchar;
  815.  
  816. beginchar(74, 2.4nhw#, 4nhh#, 0); "small F-clef";
  817.     bass(0.8);
  818. endchar;
  819.  
  820. def alt(expr reduction, yshift) =
  821.     clear;
  822.     nh:=h*reduction;
  823.     athick:=1/10nh;
  824.     ahigh:=1/2nh;
  825.  
  826.     x4=13/16nh+3thinwidth; x5=9/16nh;
  827.     x6=1/2nh; x9=x10=2/3nh; x11=17/32nh;
  828.     y4=yshift+31/50ahigh; y5=yshift+1/2ahigh;
  829.     y6=yshift; y9=yshift+1/9ahigh;
  830.     y10=yshift+ahigh; y11=yshift+11/14ahigh;
  831.     penpos4(athick,180);
  832.     penpos5(1/8athick,0);
  833.     penpos6(athick,0);
  834.     penpos9(1/3athick,90);
  835.     penpos10(1/3athick,-90);
  836.     penpos11(1/2athick,0);
  837.  
  838.     penstroke z5e..{sw+down}z6e;
  839.     penstroke z5e{se+3down}..{right}z9e{right}..{up}z4e{up}
  840.               ..{left}z10e{left}..{sw+3down}z11e;
  841.     fill fullcircle scaled (5/2thick*reduction)
  842.                     shifted (x11l+5/4thick*reduction, y11-.05nhh);
  843.     fill unitsquare xscaled athick yscaled ahigh
  844.                     shifted (5/16nh-1/2athick,yshift);
  845.     fill unitsquare xscaled 1/4athick yscaled ahigh
  846.                     shifted (x6l-1/4athick,yshift);
  847.     add_mirror ((0,yshift),(1,yshift));
  848.     penlabels(4,5,6,9,10,11)
  849. enddef;
  850.  
  851. beginchar(75,3.5nhw#, 4nhh#, 0); "Alto clef";
  852.     alt(1, 2nhh);
  853.     savepic;
  854. endchar;
  855.  
  856. beginchar(76,2.8nhw#, 4nhh#, 0); "small Alto clef";
  857.     alt(0.8 ,2nhh);
  858. endchar;
  859.  
  860. %%%%%%%%%%%%%
  861. % drum clef % (by Andreas Egler)
  862. %%%%%%%%%%%%%
  863. beginchar(77, 3nhw#, 4nhh#, 0);
  864.     fill unitsquare xscaled .5nhw yscaled 2nhh shifted (.5nhw,1nhh);
  865.     fill unitsquare xscaled .5nhw yscaled 2nhh shifted (1.5nhw,1nhh);
  866. endchar;
  867.  
  868. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  869. % this sign is sometimes used      %
  870. % to indicate a (randomly played)  %
  871. % tremolo accord (ragtime, boogie) %
  872. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  873. beginchar(78, 0, 3nhh#, 0);
  874.     clear;
  875.     x1=-x2=-.5nhw; y1=1nhh; y2=1.6nhh;
  876.     pickup med_pen;
  877.     for i=0 upto 4: draw (z1--z2) shifted (0,.4nhh*i); endfor;
  878.     labels (1,2);
  879. endchar;
  880.  
  881.  
  882. %%%%%%%%%%
  883. % shaker %
  884. %%%%%%%%%%
  885. beginchar(79, nhw#, nhh#, nhh#);
  886.     x1=x4=y2=y4=0; y1=-0.6nhh; x2=x3=w; y3=0.6nhh;
  887.     fill z1--z2--z3--z4--cycle;
  888.     labels (1,2,3,4);
  889. endchar;
  890.  
  891.  
  892. %%%%%%%%%%%%%%%%%
  893. % special signs %
  894. %%%%%%%%%%%%%%%%%
  895. %<<<>>>1.25nhh#
  896. beginchar(80, 2nhw#, 1.5*apog_nhh#, 0); "Fermate up";
  897.     x1 = y1 = y3 = 0;
  898.     y2r = 1.5nhh; 2x2l = x3 = w;
  899.     penpos1(med,180);
  900.     penpos2(1.3thick,90);
  901.     penpos3(med,0);
  902.     penstroke z1e..z2e..z3e;
  903.     fill fullcircle scaled 1.3thick shifted (.5w, .65thick);
  904.     savepic;
  905.     penlabels(1,2,3);
  906. endchar;
  907.  
  908. beginchar(81, 2nhw#, 0, 1.25nhh#); "Fermate down";
  909.     callpic;
  910.     mirror (origin, right);
  911. endchar;
  912.  
  913. beginchar(82, 2nhh#, 3nhh#, 0); "Allabreve";
  914.     2x2 = 2x4 = x1 + 2s = w;
  915.     x3r = 0; 2y1 = 3y2 = y4r = h;
  916.     y3r = 2/3h; x5 = w -2s; y5 = h -2s;
  917.     z6r = z5r + (-0.1s, .2s);
  918.     penpos1(med, 0);
  919.     penpos2(med, -90);
  920.     penpos3(s+thick,180);
  921.     penpos4(med, 90);
  922.     penpos5(med, 0);
  923.     penpos6(s+med,45);
  924.     penstroke z1e..z2e..z3e..z4e..z5e;
  925. %{{{
  926.     currentpen:= pencircle;
  927.     draw z1..z2..z3..z4..z5;
  928. %}}}
  929.     fill fullcircle scaled 1.3thick shifted z6;
  930.     savepic;
  931.  
  932.     pickup med_pen;
  933.     draw (w/2, y2r-1/8h)--(w/2, y4r+1/8h);
  934.     penlabels(1,2,3,4,5,6);
  935. endchar;
  936.  
  937. beginchar(83, 2nhh#, 3nhh#, 0); "C";
  938.     callpic;
  939. endchar;
  940.  
  941. beginchar(84, 2nhh#, 3nhh#, 0); "reverseC";
  942.     callpic;
  943.     mirror ((w/2,0),(w/2,1));
  944. endchar;
  945.  
  946. %%%%%%%%%%%%%%%%%%
  947. % repeat symbols %
  948. %%%%%%%%%%%%%%%%%%
  949. beginchar(85, 2nhw#, 3nhh#, 0); "Repeat symbol";
  950.     x2 = w-x4 = 1/6h; y2 = y4 = 1/2h;
  951.     x3 = x5 = 1/2w; y3 = h-y5 = 5/6h;
  952.     pickup pencircle scaled 1.25thin;
  953.     draw (0,h/2)--(w,h/2); draw (w/2,0)--(w/2,h);
  954.     pickup pencircle xscaled 1.2thick yscaled 1.25thin;
  955.     draw z2..z3..z4..z5..cycle;
  956.     labels (1,2,3,4);
  957. endchar;
  958.  
  959. %<<<>>>3nhw#
  960. beginchar(86, 3nhw#, 4.75apog_nhh#, 0); "Repeat symbol";
  961.     x6 = .75w;  y6 = .9w; x8 = .4w; y8l = .95w;
  962.     x11= y11 = .5w; z10 = z11+(-s,s);
  963.     penpos8 (med, -90);
  964.     penpos10 (1.8thick, 25);
  965.     penpos11 (1.8thick, 25);
  966.     penstroke z8e{left}..{se}z10e..z11e;
  967.     fill fullcircle scaled 1.6thick shifted (z8l-(0, .8thick));
  968.     fill fullcircle scaled thick shifted (.2w, .4w);
  969.     pickup penrazor scaled 0.8thick;
  970.     draw z6--z11;
  971.     addto currentpicture also currentpicture rotatedaround((.5w,.5w),180);
  972.     penlabels (8,9,11);
  973. endchar;
  974.  
  975. def pince (expr length)=
  976.     clear;
  977.     off:= w/2length;
  978.     nh:= .8nhh;
  979.     y1 = y3 = nh-y2 = nh-y4 = 1/5nh;
  980.     x1=-.5off; x2=x1+off; x3=x2+off; x4=x3+off;
  981.     pickup pensquare xscaled (thick+.15nhh) yscaled thin rotated 52;
  982.     p:= z1--z2--z3--z4;
  983.     for i=1 upto length: draw p shifted ((i-1)*2off,0); endfor
  984. enddef;
  985. %%%%%%%%%% Begin Andreas Egler's
  986. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  987. % full rest outside a staff %
  988. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  989. beginchar(5, nhw#, nhh#, 0);
  990.     fill unitsquare xscaled w yscaled .5nhh shifted (0,-.5nhh);
  991.     fill unitsquare xscaled 1.8w yscaled med shifted (-.4w,-0.5med);
  992. endchar;
  993.  
  994. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  995. % half rest outside a staff %
  996. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  997. beginchar(6, nhw#, nhh#, 0);
  998.     fill unitsquare xscaled w yscaled .5nhh;
  999.     fill unitsquare xscaled 1.8w yscaled med shifted (-.4w,-0.5med);
  1000. endchar;
  1001. %%%%%%%%%%%%%%%%%%%%%
  1002. % mordant with line %
  1003. %%%%%%%%%%%%%%%%%%%%%
  1004. beginchar(7, 1.8nhw#, apog_nhh#, 0);
  1005.     pince(3);
  1006.     pickup med_pen;
  1007.     draw ((x1,0)--(x1,2h)) shifted (-.5thick,0);
  1008. endchar;
  1009.  
  1010. %%%%%%%%%%%%%%%%%%%%%%%%
  1011. % mordant with hook ne %
  1012. %%%%%%%%%%%%%%%%%%%%%%%%
  1013. beginchar(9, 1.8nhw#, apog_nhh#, 0);
  1014.     pince(3);
  1015.     pickup pencircle scaled .75med;
  1016.     z5=2[z3,z4]-(.5thick,1/5nh); z6=z3 rotatedaround (z5,-90);
  1017.     draw (z4..z5{z4-z3}..{z3-z4}z6) shifted 2(x4-x2,0);
  1018. endchar;
  1019.  
  1020. %%%%%%%%%%%%%%%%%%%%%%%%
  1021. % mordant with hook nw %
  1022. %%%%%%%%%%%%%%%%%%%%%%%%
  1023. beginchar(10, 1.8nhw#, apog_nhh#, 0);
  1024.     pince(3);
  1025.     pickup pencircle scaled .75med;
  1026.     z5=1.75[z3,z2]-(x3-x1,0); z6=z1 rotatedaround (z5,90);
  1027.     draw (z1..z5{z2-z3}..{z3-z2}z6) shifted -(.5thick, 1/5nh);
  1028. endchar;
  1029.  
  1030. %%%%%%%%%%%%%%%%%%%%%%%%
  1031. % mordant with hook sw %
  1032. %%%%%%%%%%%%%%%%%%%%%%%%
  1033. beginchar(11, 1.8nhw#, apog_nhh#, 0);
  1034.     pince(3);
  1035.     pickup pencircle scaled .75med;
  1036.     z5=1.5[z2,z1]-.75(.5thick,1/5nh); z6=z2 rotatedaround (z5,-90);
  1037.     draw (z1..z5{z1-z2}..{z2-z1}z6);
  1038. endchar;
  1039. %%%%%%%%%% End Andreas Egler
  1040. %<<<>>> .8nhh#
  1041. beginchar(87, 1.2nhw#, apog_nhh#, 0); "Pince";
  1042.     pince(2);
  1043. endchar;
  1044.  
  1045. %<<<>>> .8nhh#
  1046. beginchar(88, 1.8nhw#, apog_nhh#, 0); "???";
  1047.     pince(3);
  1048. endchar;
  1049.  
  1050. %<<<>>> .8nhh#
  1051. beginchar(89, 1.2nhw#, apog_nhh#, 0); "Mordant";
  1052.     pince(2);
  1053.     fill unitsquare xscaled med yscaled 2h shifted ((.5w-.5med),-.5h);
  1054. endchar;
  1055.  
  1056. def arpeg (expr length)=
  1057.     clear;
  1058.     x1=.5w; y1=0; z2=z1+(0,.5nhh); z3=z1+(0,nhh);
  1059.     pickup penrazor scaled (thick+.16nhh) rotated 46;% try 50
  1060.     callpic;
  1061.     draw (z1{ne}..{nw}z2{nw}..{ne}z3) shifted (0, length*nhh);
  1062.     savepic;
  1063.     labels (1,2,3)
  1064. enddef;
  1065.  
  1066. clearpic;
  1067. for jj=0 upto 9:
  1068. %<<<>>>(1+jj)*nhh#
  1069.     beginchar(90+jj, 0.4nhw#, nhh#, 0); "Arpeggio";
  1070.         arpeg(jj);
  1071.     endchar;
  1072. endfor;
  1073.  
  1074. def trill (expr length)=
  1075.     clear;
  1076.     x1=0; y1=.5h; z2=z1+(.5nhw,0); z3=z1+(nhw,0);
  1077.     pickup penrazor scaled 1.4thick rotated 48;
  1078.     callpic;
  1079.     draw (z1{ne}..{se}z2{se}..{ne}z3) shifted (length*nhw, 0);
  1080.     savepic;
  1081.     labels (1,2,3)
  1082. enddef;
  1083.  
  1084. clearpic;
  1085. for jj=0 upto 9:
  1086. %<<<>>>0.45nhh#
  1087.     beginchar(100+jj, (jj+1)*nhw#, 0.5nhh#, 0); "Trille";
  1088.         trill(jj);
  1089.     endchar;
  1090. endfor;
  1091.  
  1092. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  1093. % general parameters for small flags %
  1094. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  1095. flagw:=0.8nhw*apog_fact;
  1096. flagthick:=apog_nhh;
  1097. flagthin:=5thinwidth*apog_fact;
  1098.  
  1099. beginchar(110, 0, 3apog_nhh#, 0); "Small 1/8flag down";
  1100.     cflag(1);
  1101. endchar;
  1102.  
  1103. beginchar(111, 0, 3.25apog_nhh#, 0); "Small 1/16flag down";
  1104.     ccflag(1);
  1105. endchar;
  1106.  
  1107. beginchar(112, 0, 4.00apog_nhh#, 0); "Small 1/32flag down";
  1108.     cccflag(1);
  1109. endchar;
  1110.  
  1111. beginchar(113, 0, 4.75apog_nhh#, 0); "Small 1/64flag down";
  1112.     ccccflag(1);
  1113. endchar;
  1114.  
  1115. beginchar(114, 0, 5.50apog_nhh#, 0); "Small 1/128flag down";
  1116.     cccccflag(1);
  1117. endchar;
  1118.  
  1119. %%%
  1120. % flags up should be wider
  1121. %%%
  1122. flagw:=nhw*apog_fact;
  1123.  
  1124. beginchar(115, 0, 3apog_nhh#, 0); "Small 1/8flag up";
  1125.     cflag(-1);
  1126. endchar;
  1127.  
  1128. beginchar(116, 0, 3.25apog_nhh#, 0); "Small 1/16flag up";
  1129.     ccflag(-1);
  1130. endchar;
  1131.  
  1132. beginchar(117, 0, 4.00apog_nhh#, 0); "Small 1/32flag up";
  1133.     cccflag(-1);
  1134. endchar;
  1135.  
  1136. beginchar(118, 0, 4.75apog_nhh#, 0); "Small 1/64flag up";
  1137.     ccccflag(-1);
  1138. endchar;
  1139.  
  1140. beginchar(119, 0, 5.50apog_nhh#, 0); "Small 1/128flag up";
  1141.     cccccflag(-1);
  1142. endchar;
  1143.  
  1144. %%%%%%%%%%%%%%%%%%%%%
  1145. % small accidentals %
  1146. %%%%%%%%%%%%%%%%%%%%%
  1147. %<<<>>>2apog_nhh#
  1148. beginchar(120, apog_nhw#, 1.5apog_nhh#, 1.5apog_nhh#); "Small flat";
  1149.     flat (apog_fact, 0, 1);
  1150.     savepic;
  1151. endchar;
  1152.  
  1153. %<<<>>>2apog_nhh#
  1154. beginchar(121,1.7*apog_fact*nhw#, 1.5apog_nhh#, 1.5apog_nhh#); "Small doubleflat";
  1155.     callpic;
  1156.     addto currentpicture also currentpicture shifted(0.7apog_fact*nhw,0);
  1157. endchar;
  1158.  
  1159. beginchar(122, 0.8apog_fact*nhw#, 1.5apog_nhh#, 1.5apog_nhh#); "Small sharp";
  1160.     sharp;
  1161. endchar;
  1162.  
  1163. %<<<>>>.5nhw#
  1164. beginchar(123, apog_nhw#, apog_nhh#, apog_nhh#); "Small doublesharp";
  1165.     doublesharp(.75w);
  1166. endchar;
  1167.  
  1168. beginchar(124, 0.8apog_fact*nhw#, 1.5apog_nhh#, 1.5apog_nhh#); "Small natural";
  1169.     natural;
  1170. endchar;
  1171.  
  1172. beginchar(125,1.5nhh#, .5nhh#, .5nhh#); "Full note with | -->  |O|";
  1173.     fill unitsquare xscaled thick yscaled nhh shifted (-4/5thick,-d);
  1174.     add_mirror ((w/2, 0),(w/2, 1));
  1175.     drawnoteb(w, h, 0, 85, 0, 1.3thick, thin);
  1176. endchar;
  1177.  
  1178. beginchar(126,0.6nhh#, 4nhh#, 0); "Repeat colons";
  1179.     fill fullcircle scaled 1.2thick shifted (0.5w, 3/8h);
  1180.     add_mirror ((0, h/2),(1, h/2));
  1181. endchar;
  1182.  
  1183. %%%%%%%%%%%
  1184. % rimshot %
  1185. %%%%%%%%%%%
  1186. def caro (expr reduction)=
  1187.     x1=w-w*reduction; y1=y3=0; x2=x4=w-.5w*reduction;
  1188.     x3=w; -y2=y4=0.6nhh*reduction;
  1189.     pickup thin_pen;
  1190.     draw z1--z2; draw z3--z4;
  1191.     pickup pencircle xscaled (.15nhw*reduction) yscaled thinwidth
  1192.                      rotated -45;
  1193.     draw z2--z3; draw z4--z1;
  1194.     labels (1,2,3,4);
  1195. enddef;
  1196.  
  1197. beginchar(127, nhw#, nhh#, nhh#);
  1198.     caro(.95);
  1199. endchar;
  1200.  
  1201.  
  1202. %%%AE some characters are 'kerned' and 'raised' by MusicTeX
  1203. %     this can be done faster with modified fonts and
  1204. %     as an additional advantage, there is more 'main memory' for
  1205. %     future enhancements, for example:
  1206. %
  1207. %\def\w@coli{\selectinstr{\p@loop\raise\altportee
  1208. %  \hbox to \z@{\hss\musicnorfont\char 126\hss}\n@portee\repeat}}%
  1209. %
  1210. %     with
  1211. %
  1212. %beginchar(126, 0, 4nhh#, 0); "Repeat colons";
  1213. %    fill fullcircle scaled 1.2thick shifted (0, 3/8h);
  1214. %    add_mirror ((0, h/2),(1, h/2));
  1215. %endchar;
  1216. %
  1217. %     becomes
  1218. %
  1219. %\def\w@coli{\selectinstr{\p@loop\raise\altportee
  1220. %  \hbox{\musicnorfont\char 126}\n@portee\repeat}}%
  1221. %
  1222. %     or
  1223. %
  1224. %\def\clefdesol{\hbox to 3.2\Interligne{\musickeyfont
  1225. %     \kern -1.2\internote\hss\char"47\hss}}%
  1226. %
  1227. %     with
  1228. %
  1229. %beginchar(71, 8/3nhw#, 5.50nhh#, 2nhh#); "G-clef";
  1230. %    violin(1);
  1231. %endchar;
  1232. %
  1233. %     becomes
  1234. %
  1235. %\def\clefdesol{\hbox{\musickeyfont\char"47}}%
  1236. %
  1237. %     or
  1238. %
  1239. %\def\d@soup{\hbox{\kern -0.3\qn@width\musicnfont\char"3F}}%
  1240. %
  1241. %     with
  1242. %
  1243. %beginchar(63, 2nhh#, 3nhh#, 0); "Quaver rest";
  1244. %     ...
  1245. %    currentpicture:= currentpicture shifted (round(-0.3nhw), 0);
  1246. %endchar;
  1247. %
  1248. %     becomes
  1249. %
  1250. %\def\d@soup{\hbox{\musicnfont\char"3F}}%
  1251. %
  1252. %     and so on
  1253.